package com.twxm.breed.service;

import com.twxm.breed.entity.LoginInfo;
import com.twxm.breed.entity.User;
import com.twxm.breed.mapper.LoginInfoMapper;
import com.twxm.breed.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class LoginAndUserService {
    @Autowired
    private UserMapper userMapper;
    @Autowired
    private LoginInfoMapper loginInfoMapper;
    @Transactional(rollbackFor = Exception.class)
    public void setAccount(LoginInfo loginInfo, User user) throws Exception{
        loginInfoMapper.insertLoginInfo(loginInfo);
        userMapper.insertNameAndId(user);
    }
}
